Discrete cosine transform method and apparatus

ABSTRACT

A linear transform apparatus for implementing a linear transform on input data values to produce linear transformed output data, the apparatus comprising: input means for inputting input data values one after another to each of a series of multiplication means; a series of multiplication means interconnected with the input means for multiplying a current input data value by a constant to produce a current multiplier output; an interconnection network interconnecting the series of multiplication means to predetermined ones of a series of signed accumulator means; a series of signed accumulator means each interconnected to the interconnection network, each of the signed accumulator means producing an intermediate accumulator output by accumulating a corresponding one of the current multiplier outputs with a corresponding previous intermediate accumulator output, each of the signed accumulator means outputting the intermediate accumulator output as a corresponding linear transformed output data value.

FIELD OF THE INVENTION

[0001] The present invention relates to transformations on data, and, in particular discloses an efficient method of implementing a discrete cosine transform

BACKGROUND OF THE INVENTION

[0002] Image transformations utilising, for example, the discrete cosine transform (DCT) are fundamental in data compression algorithms such as image compression algorithms or the like. Further, other transformations such as the Hadamard and the Karhunen-Loeve transform have been utilised in the process of reducing the number of coefficients required to represent and image. In particular, the discrete cosine transform has become a key element in fundamental multi-media algorithms such as JPEG and MPEG. The capability of the discrete cosine transform for compacting the energy of the signal into a few coefficiencies exploited for both sound and image compression. For a detailed discussion of the JPEG image compression standard, reference is made to the standard text “JPEG-still Image Data Compression Standard” by Pennebaker and Mitchell.

[0003] Due to the importance of the discrete cosine transform, a large number of efficient implementations have been proposed.

SUMMARY OF THE INVENTION

[0004] It is an object of the present invention to provide for an efficient alternative form of implementation of linear transforms such as the discrete cosine transform.

[0005] In accordance with a first aspect of the present invention, there is provided a linear transform apparatus for implementing a linear transform on input data values to produce linear transformed output data, the apparatus comprising: input means for inputting input data values one after another to each of a series of multiplication means; a series of multiplication means interconnected with the input means for multiplying a current input data value by a constant to produce a current multiplier output; an interconnection network interconnecting the series of multiplication means to predetermined ones of a series of signed accumulator means; a series of signed accumulator means each interconnected to the interconnection network, each of the signed accumulator means producing an intermediate accumulator output by accumulating a corresponding one of the current multiplier outputs with a corresponding previous intermediate accumulator output, each of the signed accumulator means outputting the intermediate accumulator output as a corresponding linear transformed output data value.

[0006] Preferably, the apparatus operates during predetermined clocking periods and the interconnection network interconnects current multiplier outputs to corresponding ones of the signed accumulator means in a single clocking period.

[0007] The linear transformed output data values can comprise a discrete cosine transform of the input data values or inverse discrete cosine transform of the input data values depending on requirements.

[0008] The interconnection network preferably can include a plurality of cross bars interconnecting predetermined ones of the multiplier means with each of predetermined ones of the signed accumulator means.

[0009] The series of the multiplication means can be implemented as a series of shifters and adders in addition to a series of partial sums.

[0010] In accordance with a further aspect of the present invention, there is provided a linear transform apparatus for implementing a linear transform on input data values to produce linear transformed output data, the apparatus comprising: input means for inputting input data values one after another to a series of multiplication means; memory storage means for storing a predetermined series of constants, and outputting a number of the constants, as determined by a corresponding input data value index, to corresponding ones of the series of multiplication means; a series of multiplication means interconnected with the memory storage means and the input means for multiplying outputted constants stored in the memory means by a current input data value to produce a current multiplier output; a series of signed accumulator means each interconnected to a single corresponding multiplication means, the signed accumulator means producing an intermediate accumulator output by accumulating a corresponding the current multiplier output with a previous intermediate output, each of the signed accumulator means outputting the intermediate accumulator output as a corresponding linear transformed output data value.

[0011] In accordance with a further aspect of the present invention, there is provided a method of implementing a linear transform on a series of input data values, the method comprising the steps of: simultaneously multiplying the a current one of the input data values by a constant value to produce a series of multiplier output values; simultaneously accumulating the multiplier output values with previous accumulations of the multiplier output values to produce intermediate transformed values; after a predetermined number of cycles outputting the intermediate transformed values as a linear transform of the input data values.

BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Notwithstanding any other forms which may fall within the scope of the present invention, preferred forms of the invention will now be described, by way of example only, with reference to the accompanying drawings in which:

[0013]FIG. 1 illustrates a first embodiment of the present invention;

[0014]FIG. 2 illustrates a second embodiment of the present invention directed to a discrete cosine transforming implementation;

[0015]FIG. 3 illustrates one form of cross bar of FIG. 2;

[0016]FIG. 4 illustrates another form of cross bar of FIG. 2; and

[0017]FIG. 5 illustrates a third form of cross bar of FIG. 2.

DESCRIPTION OF PREFERRED AND OTHER EMBODIMENTS

[0018] In the preferred embodiment of the present invention, a discrete cosine transform process is disclosed which utilizes the properties of a linear transform to provide for an more effective form of discrete cosine transform calculation circuit.

[0019] Given a N-dimensional vector x=(x₀, . . . , x_(N−1)) and a linear transform τ to be applied to it producing a vector Y=(Y₀, . . . , y_(M−1)) then the following properties hold for the linear transform: $\begin{matrix} \begin{matrix} {\overset{\rightarrow}{y} = {{\tau \left( \overset{\rightarrow}{x} \right)} = {\tau \left( \left( {x_{0},\ldots \quad,x_{N - 1}} \right) \right)}}} \\ {= {{\tau \left( \left( {x_{0},0,\ldots \quad,0} \right) \right)} + \ldots + {\tau \left( \left( {0,\ldots,x_{1},\ldots \quad,0} \right) \right)} + \ldots + {\tau \left( \left( {0,\ldots \quad,0,x_{N - 1}} \right) \right)}}} \\ {= {{x_{0}{\tau \left( \left( {1,0,\ldots \quad,0} \right) \right)}} + \ldots + {x_{i}{\tau \left( \left( {0,\ldots \quad,1,\ldots \quad,0} \right) \right)}} + {\ldots \quad x_{N = 1}{\tau \left( \left( {0,\ldots \quad,0,1} \right) \right)}}}} \\ {= {{x_{0}{\tau \left( {\overset{\rightarrow}{u}}_{0} \right)}} + \ldots + {x_{i}{\tau \left( {\overset{\rightarrow}{u}}_{1} \right)}} + \ldots + {x_{N - 1}{\tau \left( {\overset{\rightarrow}{u}}_{N - 1} \right)}}}} \end{matrix} & (1) \end{matrix}$

[0020] Eq. 1 shows that the vector x can be transformed into the vector by adding the contribution of each transformed unit vector τ({right arrow over (u)}_(i)) scaled by x_(i). The unit vectors {right arrow over (u)}_(i) have all their components equal to zero, except for the i-th which is equal to 1. Since there are only N unit vectors and since N is generally not large, when calculating {right arrow over (y)} for a large number of {right arrow over (x)}, the vectors τ({right arrow over (u)}_(i)) can be precomputed, stored in an appropriate memory and accessed according to their index i.

[0021]FIG. 1 shows a first example architecture 8 to compute a linear transform according to this method, illustrated in the case of M=N=8. Each of the components x_(i) of the vector {right arrow over (x)} is presented at the input 3 in any predetermined order. At the same time, the index i is presented at the input 1 to memory 9. The index retrieves the precomputed transformed unit vectors τ({right arrow over (u)}_(i)) from the memory 9. The retrieved vector is scaled by the x_(i) value with the multipliers 4 a to 4 h. Finally, the contribution of each scaled vector is added to the registers 6 a to 6 h using the adders 5 a to 5 h. For a transform of a N dimensional vector, N steps are required, one per component. The value of each register 6 a to 6 h is set to zero at the beginning of the transformation. After the N steps the registers 6 a to 6 h contain the value of the transformed vector τ({right arrow over (x)}_(i)) for output.

[0022] By way of refinement, it is generally possible to make changes and simplifications to this general scheme in order to take advantage of the peculiarities of each transform.

[0023] Without limiting the generality of the invention and for illustration purposes of preferred embodiments only, we can consider the standard case of the DCT on a vector {right arrow over (x)} of size 8, producing an output vector {right arrow over (y)}=c({right arrow over (x)}), again of size 8. The latter can be defined as: $\begin{matrix} {{y_{i} = {{c_{i}{\sum\limits_{j = 0}^{7}{\cos \frac{\left( {{2j} + 1} \right)i\quad \pi}{16}x_{i}\quad {with}\quad c_{0}}}} = \frac{1}{\sqrt{8}}}},{c_{i} = {\frac{1}{2}{\forall{i \neq 0}}}}} & (2) \end{matrix}$

[0024] Using Eq. 2 it is easy to calculate the transformed unit vectors c({right arrow over (u)}). These are shown below:

c({overscore (u)} ₀)=(k ₀ , k ₁ , k ₂ , k ₃ , k ₀ , k ₄ , k ₅ , k ₆)

c({overscore (u)} ₁)=(k ₀ , k ₃ , k ₅ , −k ₆ , −k ₀ , −k ₁ , −k ₂ , −k ₄)

c({overscore (u)} ₂)=(k ₀ , k ₄ , −k ₅ , −k ₁ , −k ₀ , −k ₆ , −k ₂, −k₃)

c({overscore (u)} ₃)=(k ₀ , k ₆ , −k ₂ , −k ₄ , k ₀ , k ₃ , −k ₅ , −k ₁)

c({overscore (u)} ₄)=(k ₀ , −k ₆ , −k ₂ , k ₄ , k ₀ , −k ₃ , −k ₅ , k ₁)

c({overscore (u)} ₅)=(k ₀ , −k ₄ , −k ₅ , k ₁ , −k ₀ , −k ₆ , k ₂ , −k ₃)

c({overscore (u)} ₆)=(k ₀ , −k ₃ , k ₅ , k ₆ , −k ₀ , k ₁ , −k ₂ , k ₄)

c({overscore (u)} ₇)=(k ₀ , −k ₁ , k ₂ , −k ₃ , k ₀ , −k ₄ , −k ₅ , −k ₆)  (3)

[0025] Where $\begin{matrix} {k_{i}\left\{ \begin{matrix} {c_{i}\cos \frac{\pi \quad i}{16}} & {{{{for}\quad i} = 0},1,2,3} \\ {c_{i}\cos \frac{\pi \quad \left( {i + 1} \right)}{16}} & {{{{for}\quad i} = 4},5,6} \end{matrix} \right.} & (4) \end{matrix}$

[0026] As it can readily seen from Eq. 3, it is possible to construct any transformed unit vector using a combination of seven constants k₀ to k₆ only, chosen with the appropriate sign.

[0027] This observation allows for a modification the architecture shown in FIG. 1. Such modification is shown 16 in FIG. 2. Each component x_(i) of a vector {right arrow over (x)} is presented to the input 10. It is then multiplied by each constant k₀₋₆ by the constant multipliers 11 a to 11 g. By using the 7×8 crossbar 12, a scaled, transformed unit vector x_(i) c({right arrow over (u)}_(i)) is constructed from the x_(i)k_(i) products. This can be achieved thanks to the crossbar's ability to flexibly interconnect its inputs to tis outputs. The correct sign for each of components of the crossbar output vector, according to Eq. 6, determines whether their contribution is added to or subtracted from the registers 14 a to 14 h by the adders/subtractors 13 a to 13 h. The index i of the component x_(i) determines the selection pattern for the crossbar 12 as well as the sign for adders/subtractors 13 a to 13 h.

[0028] As in the case with the arrangement of FIG. 1, eight steps, one per component, are necessary to complete the transformation of the vector {right arrow over (x)}. The registers 14 a to 14 h are cleared to zero at the start. It can be noticed that in accordance with Eq. 3, the register 14 a only needs a simple adder 13 a as the sign of each component of the vector c({right arrow over (u)}₀) is always positive.

[0029] Importantly, the same architecture shown in FIG. 2 can also be used to compute the Inverse Discrete Cosine Transform (IDCT) {right arrow over (x)}=Γ ({right arrow over (y)}) as well. In fact, in the latter case, the transformed unit vectors can be constructed using the same k_(i) constants used for the DCT.

[0030] The IDCT of each of the unit vectors is shown below:

Γ({overscore (u)} ₀)=k ₀ , k ₀ , k ₀ , k ₀ , k ₀ , k ₀ , k ₀ , k ₀)

Γ({overscore (u)} ₁)=k ₁ , k ₃ , k ₄ , k ₆ , −k ₆ , −k ₄ , −k ₃ , −k ₁)

Γ({overscore (u)} ₂)=k ₂ , k ₅ , −k ₅ , −k ₂ , −k ₂ , −k ₅ , k ₅ , k ₂)

Γ({overscore (u)} ₃)=k ₃ , −k ₆ , −k ₁ , −k ₄ , k ₄ , −k ₁ , k ₆ , −k ₃)

Γ({overscore (u)} ₄)=k ₀ , −k ₀ , −k ₀ , k ₀ , k ₀ , −k ₀ , −k ₀ , k ₀)

Γ({overscore (u)} ₅)=k ₄ , −k ₁ , k ₆ , k ₃ , −k ₃ , −k ₆ , k ₁ , −k ₄)

Γ({overscore (u)} ₆)=k ₅ , −k ₂ , k ₂ , −k ₅ , −k ₅ , k ₂ , −k ₂ , k ₅)

Γ({overscore (u)} ₇)=k ₆ , −k ₄ , k ₃ , −k ₁ , k ₁ , −k ₃ , k ₄ , −k ₆)  (5)

[0031] Thus, the construction of scaled inverse transformed unit vectors can be achieved with no modification of the circuit 16 shown in FIG. 2. In fact, the combination of the crossbar and the adder/subtractor is flexible enough for both the DCT and its inverse. As with the DCT case, each component y_(i) of the vector {right arrow over (y)} is presented at the input 10 where the appropriate vector y_(i) Γ ({right arrow over (u)}_(i)) is calculated and added to the registers 14 a to 14 h. Again, as for the DCT case, only a simple adder is required for register 14 a.

[0032] It is also possible to simplify the arrangement of FIG. 2 further to simplify the device even further. For example, it is well known that a constant multiplier can be implemented with shafters and adders. However, in this case, since multiple constants k₀ to k₆ are multiplied by the same value x_(i), some of the partial products can be shared in order to minimize the amount of hardware required in implementing multipliers k₀ to k₆.

[0033] In practical applications, the constants k₀₋₆ can be represented as fixed points numbers with as little as 11 bits each. The code fragment below shows a possible implementation of the multiplication of an integer value x by the constants k₀₋₆ of Eq. 4 in this particular case:

x 3=(x<<1)+x;

x 5=(x<<2)+x;

x 7=(x<<3)−x;

x 17=(x<<4)+x;

c 6=x 17+(x<<3);

k 6=c 6<<4;

k 5=(x 17+(x<<5))<<4;

k 4=(c 6+(x 17<<5))<<1;

k 3=x 7+(x 5 <<5)+(x 3<<9);

k 2=(c 6+(x 7<<6))<<2;

k 1=c 6+(x 3<<6)+(x 7<<8);

k 0=(x+(x 5<<5))<<3;

[0034] The variables K0-K6 will contain the value x multiplied by the constants k₀-k₆ and scaled by 4096. This code demonstrates that the multipliers 11 a to 11 g in FIG. 2 can be implemented with as little as fourteen adders. It should also be noticed that shift by a constant has no cost in terms of cell area in a VLSI implementation.

[0035] The principle of sharing partial products can also be exploited when the constants are represented with a different number of bits. In the case of different transforms, when different constants are involved, the same principle can still apply.

[0036] Another important component that can be greatly simplified is the crossbar 12. In fact, only a few of the combinations of the input to output connections are required. This can clearly be seen from looking down the columns of the matrix of Eq. 3. In particular, the only relevant ones are those that form the transformed and scaled unit vectors shown in Eq. 3 and 5.

[0037]FIG. 3 shows a possible implementation of the crossbar 12 in the case of the DCT only. This particular implementation only requires one 2×2 crossbar 21 and one 4×4 crossbar 22. Controlling the crossbar 12 is also simpler since a smaller number of selection lines are now needed.

[0038]FIG. 4 shows a possible implementation of the same crossbar 12 that allows both DCT and IDCT to be performed. Albiet slightly more complicated, its complexity is kept low in comparison to a full crossbar. Basically, the only difference consists of seven 2 to 1 multiplexers 25-31 to implement the combinations set out in Eq. 5.

[0039] Finally, FIG. 5 shows a possible implementation of the crossbar 12 in the case of the IDCT only. The arrangement 12 of FIG. 5 includes a crossbar 35 and multiplexers 36-38 and implements the matrix mapping of Eq. 5

[0040] The architecture of FIG. 4 was tested using both the DCT and its inverse tested on 8×8 blocks of data. The same type structure was used to perform both horizontal and vertical transforms (as is well known in the art). A precision of 11 bits was judged sufficient for the constants k₀-k₆. A desirable internal precision was found to be 15 bits for the horizontal transform and 14 for the vertical.

[0041] The accuracy of the transform and its inverse was tested on randomly generated blocks of 8 bit pixels as well as on real images. For each block, the DCT was calculated. The IDCT was then calculated on the result. The PSNR for IDCT output was then evaluated. If we indicate with {circumflex over (x)}_(i) the result of the DCT-IDCT transform, then the PNSR is defined as: $\begin{matrix} {{P\quad S\quad N\quad {R\quad}_{d\quad b}} = {10\log_{10}\frac{64(255)^{2}}{\sum\limits_{i = 0}^{63}\left( {x_{i} - {\hat{x}}_{i}} \right)^{2}}}} & (6) \end{matrix}$

[0042] The worst PSNR observed on over one million blocks tested was better than 51 dB. PSNR values greater than 40 dB are generally considered sufficient for most current applications.

[0043] It will therefore be evident that the preferred embodiment includes a simple and fast implementation of the DCT and its inverse. The architecture presented can be quite easily extended to other linear transform or to the DCT itself in the case of a vector's dimension larger than 8. The low complexity, low cost and high speed of the design make it particularly attractive for modern multimedia applications such as digital camera and media processors.

[0044] It would be appreciated by a person skilled in the art that numerous variations and/or modifications may be made to the present invention as shown in the specific embodiments without departing from the spirit or scope of the invention as broadly described. The present embodiments are, therefore, to be considered in all respects to be illustrative and not restrictive. 

We claim:
 1. A linear transform apparatus for implementing a linear transform on input data values to produce linear transformed output data, the apparatus comprising: input means for inputting input data values one after another to each of a series of multiplication means; a series of multiplication means interconnected with said input means for multiplying a current input data value by a constant to produce a current multiplier output; an interconnection network interconnecting said series of multiplication means to predetermined ones of a series of signed accumulator means; series of signed accumulator means each interconnected to said interconnection network, each of said signed accumulator means producing an intermediate accumulator output by accumulating a corresponding one of said current multiplier outputs with a corresponding previous intermediate accumulator output, each of said signed accumulator means outputting said intermediate accumulator output as a corresponding linear transformed output data value.
 2. A linear transform apparatus as claimed in claim 1 wherein said interconnection network comprises a cross bar interconnecting each of said multiplication means to each of said signed accumulator means.
 3. A linear transform apparatus as claimed in claim 1 wherein said apparatus operates during predetermined clocking periods and said interconnection network interconnects current multiplier outputs to corresponding ones of said signed accumulator means in a single clocking period.
 4. A linear transform apparatus as claimed in claim 1 wherein said linear transformed output data values comprise a discrete cosine transform of said input data values.
 5. A linear transform apparatus as claimed in claim 1 wherein said linear transformed output data values comprise an inverse discrete cosine transform of said input data values.
 6. A linear transform apparatus as claimed in claim 1 wherein said apparatus implements a discrete cosine transform or an inverse discrete cosine transform of said input data values.
 7. A linear transform apparatus as claimed in claim 1 wherein said interconnection network includes a plurality of cross bars interconnecting predetermined ones of said multiplier means with each of predetermined ones of said signed accumulator means.
 8. A linear transform apparatus as claimed in claim 1 wherein said series of said multiplication means is implemented as a series of shifters and adders in addition to a series of partial sums.
 9. A linear transform apparatus for implementing a linear transform on input data values to produce linear transformed output data, the apparatus comprising: input means for inputting input data values one after another to a series of multiplication means; memory storage means for storing a predetermined series of constants, and outputting a number of said constants, as determined by a corresponding input data value index, to corresponding ones of said series of multiplication means; a series of multiplication means interconnected with said memory storage means and said input means for multiplying outputted constants stored in the memory means by a current input data value to produce a current multiplier output; a series of signed accumulator means each interconnected to a single corresponding multiplication means, said signed accumulator means producing an intermediate accumulator output by accumulating a corresponding said current multiplier output with a previous intermediate output, each of said signed accumulator means outputting said intermediate accumulator output as a corresponding linear transformed output data value.
 10. A method of implementing a linear transform on a serges of input data values, said method comprising the steps of: simultaneously multiplying said a current one of said input data values by a constant value to produce a series of multiplier output values; simultaneously accumulating said multiplier output values with previous accumulations of said multiplier output values to produce intermediate transformed values; after a predetermined number of cycles outputting said intermediate transformed values as a linear transform of said input data values.
 11. A method of implementing a linear transform as claimed in claim 10 wherein said linear transform comprises a discrete cosine transform or an inverse discrete cosine transform of said input values. 